function fstar=vstar(mat,phi)
%function fstar=vstar(mat,phi); 
%vstar.m starred variable 
%For a matrix mat=[ x1  x2   xn]  (Txn)
%    and a vector of polynomial 
%    coefficients phi=[phi(1) phi(2) ... phi(q)]
%computes fstar=[f1 f2 f3 ] (Txn)
%    where each of the n columns is given by 
%    f(j)=xj-phi(1)xj(-1) -....-xj(-q)*phi(q) 
%    j=1,....,n
% First q rows are equal to zero corresponding to the lost observations 
% in lagging the columns of x
% AJ 12/8/03 
 
if phi==0
    fstar=mat
    return 
end

[T,n]=size(mat); 
[r,c]=size(phi);
if r > c
    phi=phi'; 
end 
phipol=[1 -phi]';
temp=lagmat(mat,length(phi)); 
phit=kron(phipol,eye(n));  
fstar=temp*phit; 

